package com.bmps.springcloud.insuredmicroservice.service.underwrite.strategy.minordeath.riskstrategy;

import com.bmps.springcloud.insuredmicroservice.model.accept.LcPolModel;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;

/**
 * description:
 * LBU017
 *
 * @author jackdaw
 * @date 2020-01-07 11:41
 */
@Component
public class Lbu017RiskStrategy implements RiskStrategy {

    @Override
    public BigDecimal getAmount(LcPolModel lcPolModel, List<LcPolModel> lcPolModels, boolean current) {
        BigDecimal value = (current ? lcPolModel.getPrem() : lcPolModel.getAccountValue()).multiply(BigDecimal.valueOf(0.05));
        return value.compareTo(BigDecimal.valueOf(100000d)) == 1 ? BigDecimal.valueOf(100000d) : value;
    }
}
